package 队列;

import javax.crypto.spec.PSource;
import java.util.LinkedList;
import java.util.Queue;

public class Demo {
    public static void main1(String[] args) {
        Queue<Integer> queue = new LinkedList<>();
        queue.offer(1);//入队列 offer()方法,该方法中调用add()
        queue.offer(2);//offer() 方法不抛异常，返回特殊值
        queue.offer(5);
        queue.add(6);//add()方法 抛异常

        queue.peek();//查看当前队头元素：1
        queue.poll();//弹出当前队头元素

    }

    public static void main2(String[] args) {
        单链表实现队列 myQueue = new 单链表实现队列();
        myQueue.offer(1);
        myQueue.offer(2);
        myQueue.offer(3);

        System.out.println(myQueue.peek());
        System.out.println(myQueue.poll());
        System.out.println(myQueue.poll());
        System.out.println(myQueue.poll());
        System.out.println(myQueue.isEmpty());
    }

    public static void main(String[] args) {
        int i=0;
        Integer j=new Integer(0);
        System.out.println(i==j);
        System.out.println(j.equals(i));
    }
}
